<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //构造函数的参数是一个回调函数，回调函数有两个参数
        //第一个参数是变动数组
        //第二个参数是观察器实例
        // var observer = new MutationObserver((mutations, observer)=>{
        //     mutations.forEach(function(mutation){
        //         console.log(mutation)
        //     })
        // })


        var callback = function(records){
            records.map(record=>{
                console.log('Mutation type:'+record.type)
                console.log('Mutation target:'+record.target)
            })
        }
    </script>
</body>
</html>